<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------

Route::pattern([
    'id'=>'\d+'
]);

Route::get('think', function () {
    return 'hello,ThinkPHP5!';
});

Route::get('hello/:name', 'index/hello');

Route::get('demo','index/Demo/index');

//[注册]
Route::get('/register','frontend/Index/register');
Route::post('/register','frontend/Index/register');

//[登录]
Route::any('/login','frontend/Index/login');

//[注销]
Route::get('/logout','frontend/Index/logout');

Route::get('/','frontend/Post/index');

/**********    文章      *******************/
//显示文章列表[首页]
Route::get('/postss','frontend/Post/index');

//创建文章
Route::any('/posts/create','frontend/Post/create');

//文章详情
Route::get('/posts/:id/show','frontend/Post/show');

//编辑文章
Route::any('/posts/:id/edit','frontend/Post/edit');

//删除文章
Route::get('/posts/:id/delete','frontend/Post/delete');


/*************    评论     *********************/
Route::post('/posts/comment','frontend/Post/comment');

//回复评论
Route::post('/reply','frontend/Post/reply');

/***************      用户        ***********************/
Route::any('/user/:id$','frontend/User/index');

Route::any('/user/:id/setting','frontend/User/setting');


/************     关注模块     ***********************/
Route::post('/user/:id/fan','frontend/User/fan');
Route::post('/user/:id/unfan','frontend/User/unfan');

/***********    专题模块   ***********************/
Route::get('/topic/:id$','frontend/Topic/index');

//投稿
Route::post('/topic/:id/submit','frontend/Topic/submit');

/*******   搜索模块      ************/
Route::get('/explore','frontend/Search/index');

/*******    点赞模块  ***************/
//赞
Route::get('/posts/:id/zan','frontend/Post/zan');
//取赞
Route::get('/posts/:id/unzan','frontend/Post/unzan');



/////*****     后台   *********/////

Route::group('/admin',function(){
    //登录
    Route::any('/login','backend/Index/login');

    //首页
    Route::get('/index$','backend/Index/index');

    ///*********系统管理 **********///
    /**********权限管理 ********/
    Route::get('/permissions$','backend/Power/permissions');
    //增加权限
    Route::any('/permissions/create','backend/Power/addPermissions');
    //修改权限
    Route::any('/permissions/:id/update','backend/Power/update');
    //删除权限
    Route::post('/permissions/delete','backend/Power/delete');
    //恢复权限
    Route::post('/permissions/recover','backend/Power/recover');

    /*********用户管理**********/
    //显示用户
    Route::get('/users$','backend/Power/users');
    //增加用户
    Route::any('/users/create','backend/Power/addUsers');
    //设置角色
    Route::any('/users/:id/role','backend/Power/usersRole');


    /********* 角色管理 ********/
    //显示角色
    Route::get('/roles$','backend/Power/roles');
    //增加角色
    Route::any('/roles/create','backend/Power/addRoles');
    //给角色设置权限
    Route::any('/roles/:id/permission','backend/Power/rolesPer');

    ///*********End 系统管理 **********///


    ///*********  文章管理 ************///
    //文章列表
    Route::get('/posts$','backend/Post/index');

    //未审核
    Route::get('/posts/unaudited','backend/Post/unaudited');
    //审核通过
    Route::get('/posts/pass','backend/Post/pass');
    //审核未通过
    Route::get('/posts/nopass','backend/Post/nopass');

    //操作 => 通过,拒绝,送审
    Route::post('/posts/opt','backend/Post/opt');
    ///*********End 文章管理 ************///


    ///*********  专题管理 ************///
    //专题列表
    Route::get('/topics$','backend/Topic/index');
    //添加专题
    Route::any('/topics/create','backend/Topic/create');
    //修改专题
    Route::any('/topics/:id/update','backend/Topic/update');

    //操作 => 删除,恢复
    Route::post('/topics/opt','backend/Topic/opt');

    //删除

    //恢复
    ///*********End 专题管理 ************///


    ///*********  通知管理 ************///
    //通知列表
    Route::get('/notices$','backend/Notice/index');
    //添加通知
    Route::get('/notices/create','backend/Notice/create');
    ///*********End 通知管理 ************///
});
return [

];
